# Contributor: Łukasz Jendrysik <scadu@yandex.com>
# Contributor: Carlo Landmeter <clandmeter@gmail.com>
# Maintainer:
pkgname=libzdb
pkgver=3.2
pkgrel=0
pkgdesc="A thread-safe high level multi-database connection pool library"
url="http://www.tildeslash.com/libzdb/"
arch="all"
license="GPL-3.0-only"
depends_dev="flex-dev sqlite-dev mariadb-connector-c-dev postgresql-dev"
makedepends="$depends_dev flex"
subpackages="$pkgname-dev"
source="http://www.tildeslash.com/libzdb/dist/libzdb-$pkgver.tar.gz
	missing-assert.patch"
builddir="$srcdir/$pkgname-$pkgver"

build() {
	cd "$builddir"
	./configure --prefix=/usr \
		--sysconfdir=/etc \
		--mandir=/usr/share/man \
		--enable-optimized \
		--infodir=/usr/share/info
	make || return 1
}

check() {
	cd "$builddir"
	# The test is manual and requires user input, we spam the dot char
	# because it is a valid name for the database required by the test
	# and dot is also the char for exiting the database once test is
	# complete
	yes . | make verify
}

package() {
	cd "$builddir"
	make DESTDIR="$pkgdir" install || return 1
}

sha512sums="b44ee217c0b221812eb2d1be03edcc8e74a5e3907ac3915defc15fa5faf228dac175bd04591fedf5d706773ab85f2dc98cd14c7a84ade5887f4f644d64739824  libzdb-3.2.tar.gz
4547386470ac74079c41fcec9fb1e4129283982f0b489a2bd57f49586f25e900004ff5d6e61e796eac9ccd35c29e52aae184ec98802b23ad9f216213159b5db2  missing-assert.patch"
